<template>
	<view class="" v-if="loadStatus">
		<view class="list">
			<block v-for="(item, index) in list" :key="index">
				<view class="item solid-bottom">
					<view class="name">
						<text class="text-bold margin-right">{{item.out_name}} </text>
						<text class="text-gray text-sm  margin-right to">转到</text>
						<text class="text-bold">{{item.in_name}}</text>
					</view>
					<view class="flex align-center justify-between">
						<view class="text-price text-bold text-red">{{numberFormatter(item.amount)}}</view>
						<view class="text-gray text-sm">{{item.date}}</view>
					</view>
				</view>
			</block>
		</view>

	</view>
</template>

<script>
	var that;
	import FundsModel from '../../models/FundsModel';
	export default {
		data() {
			return {
				loadStatus: false,
				page: 1,
				pageStatus: 0,
				list: []
			}
		},
		onLoad(options) {

			uni.showLoading();

			this.getList()
			this.loadStatus = true;
			uni.hideLoading();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			async getList() {
				if (this.pageStatus != 0) {
					return false;
				}

				const res = await FundsModel.transferRecord(this.page)
				if (res.code == 200) {
					this.page++;
					this.list = this.list.concat(res.data.list);
					if (this.list.length >= res.data.total) {
						this.pageStatus = 2;
					} else {
						this.pageStatus = 0;
					}
				}
			}
		}
	}
</script>

<style scoped lang="less">
	.item {
		padding: 20upx;
		border-bottom: 1rpx solid #eee;
		font-size: 28rpx;

		.name {
			margin-bottom: 12upx;
		}
		
		.to{
			margin: 0 20rpx;
		}
	}
</style>